// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   register_ok.java

package hr.engage.questiones;

import include.nseer_cookie.counter;
import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class register_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;

	public register_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			PrintWriter out = response.getWriter();
			counter count = new counter(dbApplication);
			nseer_db_backup1 hr_db = new nseer_db_backup1(dbApplication);
			if (hr_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String first_kind_ID = "";
				String first_kind_name = "";
				String second_kind_ID = "";
				String second_kind_name = "";
				String first_kind = request.getParameter("select1");
				for (StringTokenizer tokenTO4 = new StringTokenizer(first_kind, "/"); tokenTO4.hasMoreTokens();)
				{
					first_kind_ID = tokenTO4.nextToken();
					first_kind_name = tokenTO4.nextToken();
				}

				String second_kind = request.getParameter("select2");
				for (StringTokenizer tokenTO5 = new StringTokenizer(second_kind, "/"); tokenTO5.hasMoreTokens();)
				{
					second_kind_ID = tokenTO5.nextToken();
					second_kind_name = tokenTO5.nextToken();
				}

				String register = request.getParameter("register");
				String register_time = request.getParameter("register_time");
				String derivation = request.getParameter("derivation");
				String body = new String(request.getParameter("body").getBytes("UTF-8"), "UTF-8");
				String content = exchange.toHtml(body);
				String bodya = new String(request.getParameter("bodya").getBytes("UTF-8"), "UTF-8");
				String keya = exchange.toHtml(bodya);
				String bodyb = new String(request.getParameter("bodyb").getBytes("UTF-8"), "UTF-8");
				String keyb = exchange.toHtml(bodyb);
				String bodyc = new String(request.getParameter("bodyc").getBytes("UTF-8"), "UTF-8");
				String keyc = exchange.toHtml(bodyc);
				String bodyd = new String(request.getParameter("bodyd").getBytes("UTF-8"), "UTF-8");
				String keyd = exchange.toHtml(bodyd);
				String bodye = new String(request.getParameter("bodye").getBytes("UTF-8"), "UTF-8");
				String keye = exchange.toHtml(bodye);
				String correctkey = request.getParameter("correctkey");
				try
				{
					String sql = (new StringBuilder("insert into hr_questiones(first_kind_ID,second_kind_ID,first_kind_name,second_kind_name,register,register_time,derivation,content,keya,keyb,keyc,keyd,keye,correctkey) values ('")).append(first_kind_ID).append("','").append(second_kind_ID).append("','").append(first_kind_name).append("','").append(second_kind_name).append("','").append(register).append("','").append(register_time).append("','").append(derivation).append("','").append(content).append("','").append(keya).append("','").append(keyb).append("','").append(keyc).append("','").append(keyd).append("','").append(keye).append("','").append(correctkey).append("')").toString();
					hr_db.executeUpdate(sql);
				}
				catch (Exception ex)
				{
					out.println((new StringBuilder("error")).append(ex).toString());
				}
				hr_db.commit();
				hr_db.close();
				response.sendRedirect("hr/engage/questiones/register_ok_a.jsp");
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception exception) { }
	}
}
